#include <iostream>
#include "./include/HeapWold.h"
#include <cstring>
#include <memory>
#include <stdio.h>
#include "./include/Iterator.h"
#include "./include/Aggregate.h"
#include "./include/ConcreateAggregate.h"
#include "./include/RBTree.h"

#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))


struct XX
{
	char* str;
	int strLen;
};

int main()
{

	HeapWold* h = new HeapWold(10);

	memset(h, 0, 16);

	std::cout << h->Getm_Counter() << std::endl;






	struct XX foo[] =
	{
		{C_STRING_WITH_LEN("aaaaaaaaa")},
		{C_STRING_WITH_LEN("da da di di bang aodafl")},
		{C_STRING_WITH_LEN("len")},
		{C_STRING_WITH_LEN("apple?")},
		{C_STRING_WITH_LEN("vim is easy?")},
		{C_STRING_WITH_LEN("how long will it take? master")},
		{NULL, 0}
	};

	int i = 0;
	for (i = 0; i < 5; i++)
	{
		fprintf(stdout, "%s, %d\n", foo[i].str, foo[i].strLen);
	}

	Aggregate<double>* pkg = new ConcreateAggregate<double>(6);

	Iterator<double>* itera = pkg->crateIterator();


	for (itera->first(); !itera->isDone(); itera->next())
	{
		std::cout << "value:" << itera->getCurrentItem() << std::endl;
	}

	int a[] = { 10, 7, 8, 15, 5, 6, 11, 13, 12 };
	RBTree<int, int> rt;
	for (size_t i = 0; i < sizeof(a) / sizeof(a[0]); ++i)
		rt.insertUnique(std::pair<int, int>(a[i], i));

	RBTree<int, int>::Iterator it = rt.begin();

	while (it != rt.end())
	{
		std::cout << (*it).first << " lllll";
		++it;
	}
	std::cout << std::endl;


	return 0;
}
